{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Smallest Even Multiple"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #math #number-theory"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数学 #数论"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: smallestEvenMultiple"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #最小偶倍数"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "给你一个正整数 <code>n</code> ，返回 <code>2</code><em> </em>和<em> </em><code>n</code> 的最小公倍数（正整数）。\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>n = 5\n",
    "<strong>输出：</strong>10\n",
    "<strong>解释：</strong>5 和 2 的最小公倍数是 10 。\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>n = 6\n",
    "<strong>输出：</strong>6\n",
    "<strong>解释：</strong>6 和 2 的最小公倍数是 6 。注意数字会是它自身的倍数。\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 &lt;= n &lt;= 150</code></li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [smallest-even-multiple](https://leetcode.cn/problems/smallest-even-multiple/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [smallest-even-multiple](https://leetcode.cn/problems/smallest-even-multiple/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['5', '6']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n == 1:\n",
    "            return 2\n",
    "        elif n%2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "      for i in range (1,1000):\n",
    "        if i % 2 == 0 and i % n == 0:\n",
    "          return i;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "  smallestEvenMultiple = lambda _, n:math.lcm(2, n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 1:\n",
    "            return 2*n\n",
    "        else:\n",
    "            return n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return (n%2+1)*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "      ans = n if n % 2 == 0 else n * 2\n",
    "      return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n*(n%2+1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return 2 * n if n % 2 else n\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n & 1:\n",
    "            return n * 2\n",
    "        else:\n",
    "            return n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return lcm(2,n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return (n % 2 + 1) * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if mod(n,2)==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        for i in range(1,10000):\n",
    "            if i % 2 == 0 and i % n == 0:\n",
    "                return i"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        a=n/2\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n+n%2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n==1:\n",
    "            return 2\n",
    "        if n%2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        mode=1\n",
    "        while mode>0:\n",
    "            if mode%2==0 and mode%n==0:\n",
    "                return mode\n",
    "                break\n",
    "            else:\n",
    "                mode+=1    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if (n%2) != 0:\n",
    "            return 2*n\n",
    "        else:\n",
    "            return n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "          return n\n",
    "        else:\n",
    "          return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if 2 > n:\n",
    "            if 2 % n == 0:\n",
    "                return 2\n",
    "            else:\n",
    "                return 2 * n\n",
    "        elif n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            print(n)\n",
    "            return n\n",
    "        else:\n",
    "            print(2*n)\n",
    "            return 2*n\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            return(n)\n",
    "        else:\n",
    "            return(n*2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2\n",
    "      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return (n % 2 + 1) * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2\n",
    "      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return lcm(2, n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        \n",
    "        return lcm(2, n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n%2==0 else 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n * 2 if n & 1 else n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:return n \n",
    "        return 2*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        c=n\n",
    "        \n",
    "        while n%2 ==0 and ((n*2)>c):\n",
    "            \n",
    "            n=n/2\n",
    "        return int(n*2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 ==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        x = max(2,n)\n",
    "        while x <= 2*n:\n",
    "            if x%2 == 0 and x%n == 0:\n",
    "                return x\n",
    "            x += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 != 0:\n",
    "            return 2 * n\n",
    "        else:\n",
    "            return n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n * 2 if n % 2 != 0 else n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return (n%2+1)*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 ==0:\n",
    "            return n\n",
    "        return 2 * n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n\n",
    "             \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n << 1 if n & 1 else n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return n if n % 2 == 0 else n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return n*2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    # def smallestEvenMultiple(self, n: int) -> int:\n",
    "    #     if n % 2 == 0:\n",
    "    #         return n\n",
    "    #     else:\n",
    "    #         return 2 * n\n",
    "    \n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        def gcd(n: int, m: int) -> int:\n",
    "            return gcd(m, n % m) if m else n\n",
    "        return n // gcd(n, 2) * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n % 2 == 0:\n",
    "            return n\n",
    "        return n * 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        return lcm(2, n)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEvenMultiple(self, n: int) -> int:\n",
    "        if n%2==0:\n",
    "            return n\n",
    "        else:\n",
    "            return 2*n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
